<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    div{
        margin: 0 auto;
        width: 600px;
        height: 400px;
        text-align: center;
    }
   img{
    width: 600px;
        
   }
</style>
<body>
    <div>
      <button id="hug">胡歌</button>
      <button id="pyy">彭于晏</button>
      <img src="/跟着狂神/img/彭于晏.jpg" alt="" title="">
    </div>
    <script>
       var hug=document.getElementById('hug')
       var pyy=document.getElementById('pyy')
       var img=document.querySelector('img')
       hug.onclick=function(){
        img.src='/跟着狂神/img/04.jpg'
        img.title='胡歌'
       }
       pyy.onclick=function(){
        img.src='/跟着狂神/img/彭于晏.jpg'
        img.title='彭于晏'
       }
    </script>
</body>
</html>